
import * as webpack from 'webpack'
import * as path from "path"

import UglifyJsPlugin from 'uglifyjs-webpack-plugin'

const config: webpack.Configuration = {
    mode: 'production',
    entry: "./src/index.ts",
    output: {
        library: {
            type: "umd"
        },
        libraryExport: "default",
        libraryTarget: "c",
        path: path.resolve(__dirname, "dist"),
        filename: "[name].js"

    },

    plugins: [

        // new UglifyJsPlugin({
        //     // sourceMap: true,
        //     uglifyOptions: {
        //         compress: {
        //             drop_console: true,
        //             drop_debugger: true,
        //             pure_funcs: ['console.log']
        //         }
        //     }
        // }) as webpack.WebpackPluginInstance



    ],
    module: {
        rules: [
            {
                test: "/\.(ts|tsx)$/i",
                use: {
                    loader: "ts-loader",
                },
                exclude: ["node_modules"]
            },
        ]


    },
    resolve: {
        extensions: [".tsx", ".ts", ".js", ".json"]
    }


}


export default config;
